<template>
	<view class="" style="display: inline-block;">
		<view class=""
			style="border: 1px solid #ddd;height: auto;display: flex;align-items: center;color: #000000;opacity: 0.7;padding:10rpx 5rpx;">
			<text @click="show1Open()">{{alarm_stat_start || '开始时间'}}</text>  <text style="margin:0 10rpx;">-</text>  <text @click="show2Open()">{{alarm_stat_end || '结束时间'}}</text>
			<u-icon name="calendar" size="25"></u-icon>
		</view>
		<u-datetime-picker @cancel="close1" @confirm="confirm1" v-model="date1" :show="show1"  mode="datetime"></u-datetime-picker>
		<u-datetime-picker @cancel="close2" @confirm="confirm2" v-model="date2"  :show="show2"  mode="datetime"></u-datetime-picker>
	</view>

</template>

<script>
	export default {
		props: {
			alarm_stat_start:{
				type:String,
				default:''
			},
			alarm_stat_end:{
				type:String,
				default:''
			}
		},
		data() {
			return {
				show1: false,
				show2: false,
				date1:Number(new Date()),
				date2:Number(new Date()),
			}
		},
		methods: {
			show1Open(){
				this.show1 = true
			},
			show2Open(){
				this.show2 = true
			},
			close1(){
				this.show1 = false
			},
			close2(){
				this.show2 = false
			},
			confirm1(e){
				let alarm_stat_start = this.$u.timeFormat(e.value,'yyyy-mm-dd hh:MM');
				this.show1 = false
				this.$emit('time1Confirm',alarm_stat_start)
			},
			confirm2(e){
				let alarm_stat_end = this.$u.timeFormat(e.value,'yyyy-mm-dd hh:MM');
				this.show2 = false
				this.$emit('time2Confirm',alarm_stat_end)
			},
		}

	}
</script>

<style scoped>

</style>
